﻿using System.Windows.Forms;

namespace Kyoh.Lib.WinForms
{
    /// <summary>コレクションとメニュー項目をバインド可能なメニュー。</summary>
    public class BindableToolStripMenuItem : ToolStripMenuItem, IBindableComponent
    {
        #region IBindableComponent Members

        private BindingContext _bindingContext;
        private ControlBindingsCollection _dataBindings;

        /// <summary><see cref="IBindableComponent"/> の CurrencyManager のコレクションを取得または設定します。</summary>
        public BindingContext BindingContext
        {
            get { return _bindingContext ?? (_bindingContext = new BindingContext()); }
            set { _bindingContext = value; }
        }

        /// <summary>この <see cref="IBindableComponent"/> の <see cref="BindingManagerBase"/> オブジェクトのコレクション。</summary>
        public ControlBindingsCollection DataBindings
        {
            get { return _dataBindings ?? (_dataBindings = new ControlBindingsCollection(this)); }
        }

        #endregion
    }
}